import UIKit

public class PaddingLabel: UILabel {
    public var padding: UIEdgeInsets = .zero {
        didSet {
            setNeedsDisplay()
        }
    }
    
    public override func drawText(in rect: CGRect) {
        super.drawText(in: rect.inset(by: padding))
    }
    
    public override var intrinsicContentSize: CGSize {
        let size = super.intrinsicContentSize
        return CGSize(
            width: size.width + padding.left + padding.right,
            height: size.height + padding.top + padding.bottom
        )
    }
} 
